const mongoose = require('mongoose')
// const Category = require('./Category')

const schema = new mongoose.Schema({
  ename: { type: Number },
  name: { type: String },
  avatar: { type: String },
  title: { type: String },
  heroType: [{
    type: mongoose.SchemaTypes.ObjectId,
    ref: 'Category'
  }],
  scores: {
    difficult: { type: Number },
    skill: { type: Number },
    attack: { type: Number },
    survive: { type: Number }
  },
  skills: [{
    icon: { type: String },
    name: { type: String },
    cd: { type: String },
    blue: { type: String },
    description: { type: String },
    tip: { type: String }
  }],
  point: {
    skill: [{ type: Number }],
    summoner: [{
      type: mongoose.SchemaTypes.ObjectId,
      ref: 'Summoner'
    }]
  },
  items1: {
    items: [{
      type: mongoose.SchemaTypes.ObjectId,
      ref: 'Item'
    }],
    tip: { type: String }
  },
  items2: {
    items: [{
      type: mongoose.SchemaTypes.ObjectId,
      ref: 'Item'
    }],
    tip: { type: String }
  },
  mings: [{
    type: mongoose.SchemaTypes.ObjectId,
    ref: 'Ming'
  }],
  skinName: [{ type: String }],
  usageTips: { type: String },
  battleTips: { type: String },
  teamTips: { type: String },
  related: {
    partners: [{
      name: {
        type: mongoose.SchemaTypes.ObjectId,
        ref: 'Hero'
      },
      description: { type: String }
    }],
    weak: [{
      name: {
        type: mongoose.SchemaTypes.ObjectId,
        ref: 'Hero'
      },
      description: { type: String }
    }],
    strong: [{
      name: {
        type: mongoose.SchemaTypes.ObjectId,
        ref: 'Hero'
      },
      description: { type: String }
    }]
  }
})

module.exports = mongoose.model('Hero', schema, 'heroes')